package cn.gailvlun.gll.mgr.upload;

import com.alibaba.sdk.android.oss.ClientException;
import com.alibaba.sdk.android.oss.ServiceException;
import com.alibaba.sdk.android.oss.model.OSSRequest;
import com.alibaba.sdk.android.oss.model.OSSResult;

import cn.gailvlun.gll.mgr.UploadResult;
import io.reactivex.Observer;
import io.reactivex.disposables.Disposable;



public abstract class OssSubscriber<T1 extends OSSRequest, T2 extends OSSResult> implements Observer<UploadResult<T1, T2>> {
    @Override
    public void onSubscribe(Disposable d) {

    }

    @Override
    public void onNext(UploadResult<T1, T2> t1T2UploadResult) {
        onSuccess(t1T2UploadResult.getRequest(), t1T2UploadResult.getResponse());
    }

    @Override
    public void onError(Throwable e) {

    }

    @Override
    public void onComplete() {

    }

    public abstract void onSuccess(T1 request, T2 result);
    public abstract void onFailure(T1 request, ClientException clientException, ServiceException serviceException);
}
